package org.odk.collect.android.activities;

import java.util.ArrayList;

import org.odk.collect.android.R;
import org.odk.collect.android.R.layout;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.Toast;


public class Createprefill extends Activity {
	public static Spinner spinner2;
	ArrayAdapter<String> dataAdapter;
	public static String chosen;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_createprefill);
		Intent intent = getIntent();
		spinner2 = (Spinner) findViewById(R.id.spinner2);
		ArrayList<String> list = new ArrayList<String>();

		list.add("NREGA ID");
		list.add("District");
		list.add("Panchayat");

		dataAdapter = new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item, list);
		dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		spinner2.setAdapter(dataAdapter);
		Button btnSubmit = (Button) findViewById(R.id.create_prefilled_forms);
		btnSubmit.setOnClickListener(new OnClickListener() {

			public void onClick(View v) {

				
				chosen = String.valueOf(Createprefill.spinner2.getSelectedItem());
				System.out.println(chosen);
				Intent i = new Intent(getApplicationContext(), Prefiller.class);
		    	 i.putExtra("string", chosen);
	                startActivity(i); 


			}
	    
			   
	    
	        });

		
    }

       		
        
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.layout.activity_createprefill, menu);
        return true;
    }

    
}
